package cn.cdeden.knowledge.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * TODO
 *
 * @author username
 * @date 2024/1/17 15:56
 * @describe:
 **/
@Getter
@AllArgsConstructor
public enum OperationEnum {
    QUERY("查询","query"),
    INSERT("新增","insert"),
    DELETE("删除","delete"),
    UPDATE("变更","update"),
    RECOVER("还原","recover"),
    COPY("复制","copy"),
    MOVE("移动","move");

    private final String operationName;
    private final String operationCode;

    @Getter
    @AllArgsConstructor
    public enum OperationTypeEnum{
        FILE("文件","file"),
        FOLDER("文件夹","folder"),
        RICHTEXT("表单文档","richText"),
        JURISDICTION("权限","jurisdiction");

        private final String operationTypeName;
        private final String operationTypeCode;
    }
    public String getOperation(OperationTypeEnum operationType) {
        if (operationType!=null){
            return this.getOperationName()+operationType.getOperationTypeName();
        }else {
            return "";
        }
    }

    public String judgmentType(String type) {
        OperationTypeEnum typeEnum = null;
        switch (type) {
            case "file":
                typeEnum = OperationTypeEnum.FILE;
                break;
            case "folder":
                typeEnum = OperationTypeEnum.FOLDER;
                break;
            case "richText":
                typeEnum = OperationTypeEnum.RICHTEXT;
                break;
        }
        return this.getOperationName()+typeEnum.getOperationTypeName();
    }


}
